package com.example.serverdemo.controller.base;

import com.example.serverdemo.common.WisStatusCode;
import lombok.Data;

@Data
public class BaseResult {

    private Integer code;

    private String msg;

    private Object data;

    public static BaseResult success() {
        BaseResult res = new BaseResult();
        res.code = WisStatusCode.SUCCESS;
        res.msg = "SUCCESS";
        return res;
    }

    public static BaseResult success(Object obj) {
        BaseResult res = new BaseResult();
        res.code = WisStatusCode.SUCCESS;
        res.msg = "SUCCESS";
        res.data = obj;
        return res;
    }

    public static BaseResult fail(int code, String msg) {
        BaseResult res = new BaseResult();
        res.code = code;
        res.msg = msg;
        return res;
    }

}